<div id="contract-manage-view">
  <div class="page">
    <div class="al-list-container">
      <form class="form-horizontal al-search-container" role="form">
        <div class="form-group">
          <label class="col-sm-1 control-label">公寓</label>
          <div class="col-sm-3" ng-if="apartmentList.length>1">
            <qgy-apartment-item apm-data="search" apm-list="apartmentList"></qgy-apartment-item>
          </div>
          <label class="col-sm-2 control-label">签约日期</label>
          <div class="col-sm-2">
            <div class="input-group">
              <input class="form-control" type="text" uib-datepicker-popup="yyyy-MM-dd"
                     ng-model="search.signTimeStart" is-open="enterStart" maxlength="10"
                     close-text="关闭" current-text="今天" clear-text="清空"
                     placeholder=""/>
              <span class="input-group-btn">
                <button type="button" class="btn btn-default" ng-click="enterStart=true">
                  <i class="glyphicon glyphicon-calendar"></i>
                </button>
              </span>
            </div>
          </div>
          <label class="control-label text-center al-fl-lt">&nbsp;&nbsp;~&nbsp;&nbsp;</label>
          <div class="col-sm-2">
            <div class="input-group">
              <input class="form-control" type="text" uib-datepicker-popup="yyyy-MM-dd"
                     ng-model="search.signTimeEnd" is-open="enterEnd" maxlength="10"
                     close-text="关闭" current-text="今天" clear-text="清空"
                     placeholder=""/>
              <span class="input-group-btn">
                <button type="button" class="btn btn-default" ng-click="enterEnd=true">
                  <i class="glyphicon glyphicon-calendar"></i>
                </button>
              </span>
            </div>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-1 control-label">租期</label>
          <div class="col-sm-3">
            <select ng-model="search.lease" class="form-control"
                    ng-options="option.value as option.name for option in leaseList"></select>
          </div>
          <label class="col-sm-2 control-label">筛选</label>
          <div class="col-sm-4" style="line-height: 33px;">
            <input type="checkbox" ng-model="search.more10Day">
            十五天内到期的合同&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="checkbox" ng-model="search.useActivity">
            参与优惠活动
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-1 control-label">状态</label>
          <div class="col-sm-4">
            <label class="ui-radio">
              <input name="status" ng-value="2" type="checkbox" ng-model="search.status_2"  ng-checked="isSelected(2)" ng-click="updateSelection($event,2)">
              <span>已签约</span>
            </label>
            <label class="ui-radio">
              <input name="status" ng-value="4" type="checkbox" ng-model="search.status_4"  ng-checked="isSelected(4)" ng-click="updateSelection($event,4)">
              <span>待入住</span>
            </label>
            <label class="ui-radio">
              <input name="status" ng-value="8" type="checkbox" ng-model="search.status_8"  ng-checked="isSelected(8)" ng-click="updateSelection($event,8)">
              <span>已入住</span>
            </label>
            <label class="ui-radio">
              <input name="status" ng-value="16" type="checkbox" ng-model="search.status_16"  ng-checked="isSelected(16)" ng-click="updateSelection($event,16)">
              <span>已退租</span>
            </label>
            <label class="ui-radio">
              <input name="status" ng-value="32" type="checkbox" ng-model="search.status_32"  ng-checked="isSelected(32)" ng-click="updateSelection($event,32)">
              <span>已续约</span>
            </label>
            <label class="ui-radio">
              <input name="status" ng-value="64" type="checkbox" ng-model="search.status_64"  ng-checked="isSelected(64)" ng-click="updateSelection($event,64)">
              <span>已换房</span>
            </label>
            <label class="ui-radio">
              <input name="status" ng-value="128" type="checkbox" ng-model="search.status_128"  ng-checked="isSelected(128)" ng-click="updateSelection($event,128)">
              <span>已违约</span>
            </label>
            <label class="ui-radio">
              <input name="status" ng-value="256" type="checkbox" ng-model="search.status_256"  ng-checked="isSelected(256)" ng-click="updateSelection($event,256)">
              <span>已转租</span>
            </label>
          </div>
          <div class="col-sm-3 ">
            <input class="form-control" type="text" placeholder="房间号，姓名，手机号"
                   ng-model="search.searchStr" maxlength="32">
          </div>
          <div class="col-sm-1 ">
            <button type="button" ng-click="queryData()" class="btn btn-success al-float-right">查询</button>
          </div>
          <div class="col-sm-1">
            <button type="button" ng-click="resetSearch()" class="btn btn-default">重置</button>
          </div>
        </div>
      </form>
      <table ng-table="tableParams"
             class="table  table-bordered table-striped table-condensed al-table-container">
        <thead>
        <tr>
          <td>合同号</td>
          <td>公寓</td>
          <!--<td>楼栋</td>-->
          <td>房间号</td>
          <td>房间租金</td>
          <td>实付租金</td>
          <td>租房人手机</td>
          <td>租房人姓名</td>
          <td>租房方式</td>
          <td>签约日期</td>
          <td>起租日期</td>
          <td>租期</td>
          <td>优惠活动</td>
          <td>状态</td>
          <td>操作</td>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="item in $data">
          <td>{{item.uuid}}</td>
          <td>{{item.apartmentName}}</td>
          <!--<td>{{item.buildingName}}</td>-->
          <td>{{item.houseNo}}</td>
          <td>{{item.originalRental}}</td>
          <td>{{item.rental}}</td>
          <td>{{item.customerPhone}}</td>
          <td>{{item.customerName}}</td>
          <td>{{item.payWayName}}</td>
          <td>{{item.signTime|dateTransfer:'YYYY-MM-DD'}}</td>
          <td>{{item.leaseStart|dateTransfer:'YYYY-MM-DD'}}</td>
          <td>{{item.leaseName}}</td>
          <td>{{item.feeDesc}}</td>
          <td>{{item.statusName}}</td>
          <td>
            <button class="btn btn-warning btn-sm"
                    ng-if="item.status==2 || item.status==4"
                    ng-click="editData(item)">编辑</button>
            <button class="btn btn-info btn-sm" ng-click="goDetail(item)">查看</button>
            <!--<button class="btn btn-danger btn-sm" ng-confirm-click="确定要删除这个房型吗？" ng-click="removeData(item)">删除</button>-->
          </td>
        </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
